<template>
  <div class="login">
      <p>账号：<input type="text" v-model="username"></p>
      <p>密码：<input type="text" v-model="password"></p>
      <p><button @click="handleLogin">登录</button></p>
      <p class="opreate"><a href="javascript:;">忘记密码？</a><a href="">注册</a></p>
  </div>
</template>

<script>
import {mapActions} from 'vuex'
export default {
   data(){
       return {
           username:'',
           password:''
       }
   },
   created(){
      
   },
   methods:{
       ...mapActions(['getLogin']),
       handleLogin(){
           this.getLogin({username:this.username,password:this.password}).then(res=>{         
               if(res.code===1){
                   this.$router.push('/')
               }
           })
       }
   }
}
</script>

<style scoped lang='scss'>
.login{
    width: 100%;
    height: 100%;
    padding: 20px;
}
</style>